package com.shiro.repsoitory;

import com.shiro.base.dao.BaseDao;
import com.shiro.common.entity.Role;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface RoleRepository extends BaseDao<Role> {

    @Query("select r from Role r left join fetch r.userList u where u.id = :userId")
    List<Role> findAllByUserId(@Param("userId") Long userId);

}
